package com.xiyuan.smartutils.filters;

import java.io.File;
import java.io.FilenameFilter;

/**
 * 文件名后缀过滤器，要求不是指定结尾的
 *
 * @version v1.0.0 @author lgz 2017-4-11 新建与整理
 */
public class FileNameNotEndsWithFilter implements FilenameFilter
{
    private String suffix;
    
    public FileNameNotEndsWithFilter(String suffix)
    {
        this.suffix = suffix;
    }
    
    public FileNameNotEndsWithFilter param(String suffix)
    {
        this.suffix = suffix;
        return this;
    }
    
    @Override
    public boolean accept(File dir, String name)
    {
        return !name.endsWith(suffix);
    }
}
